home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DDJMAG / DDJ9207.ZIP / LETTERS.ASC < prev    next >
Text File  |  1992-06-15  |  2KB  |  99 lines

  1. _LETTERS_
  2.  
  3. [LISTING ONE]
  4.  
  5. void PatchSFT ( void )
  6. { char *sft,
  7.        *next_sft;
  8.   unsigned num_files;
  9.   int found;
  10.  
  11.   // get first SFT block
  12.   _AH = 0x52;
  13.   geninterrupt ( 0x21 );
  14.   sft = * (char ** ) MK_FP ( _ES, _BX + 4 );
  15.  
  16.   // searchthru till end of block chain
  17.   while ( sft != ( char * ) 0x0000ffff ) {
  18.     next_sft = * ( char ** ) sfrt;
  19.     // each block indicates the
  20.     //  number of elements within
  21.     num_files = * ( int * ) ( sft + 4 );
  22.     sft += 6;
  23.     // search thru this block's
  24.     //  elements looking for match
  25.     do {
  26.       found = strncmp ( drvptr + 10, sft + 32, 8 );
  27.       sft += _osmajor < 4 ? 53 : 59 ;
  28.     } while ( --num-files && found !+ 0 );
  29.     sft = next_sft;
  30.   }
  31.  
  32.   if ( found == 0 ) {
  33.     ( char ** ) ( sft + 7 ) = drvptr;
  34.     ( unsigned * ) ( sft + 11) = FP_OFF ( drvptr );
  35.   }
  36. }
  37.  
  38.  
  39. [LISTING TWO]
  40.  
  41. ;                      as generated by SoundBlaster as a pulse width
  42. ;                      modulated signal on the internal IBM speaker,
  43.  
  44. VoiceTrkParms   struc
  45.     dw          4 dup (?)     ; pushed BP, ES and return address
  46. StartOffset     dw ?          ;  offset of address of voice track buffer
  47. StartSegment    dw ?          ; segment address of voice track buffer
  48. ;StartOffset    dw ?          ; offset of address of voice track buffer
  49. TrackLength     dw ?          ; Length of voice track
  50. VoiceTrkParms   ends
  51.         .model large
  52.         .code
  53.         public _VoiceTrk
  54.  
  55. _VoiceTrk proc far
  56.     push    bp
  57.     push    es
  58.     mov     bp,sp
  59.     mov     si,StartOffset[bp]
  60.     mov     es,StartSegment[bp]
  61.     mov     cx,TrackLength[bp]
  62.     in      al,61h
  63.     push    ax
  64.     mov     ah,1Fh
  65.     and     al,0FCh
  66.     out     61h,al
  67.     mov     bp,0
  68.     cli
  69. OuterLoop:
  70.     mov     dh,0
  71.     mov     dl,es:[si+bp]
  72.     test    dl,ah
  73.     jz      InnerLoop
  74.     or      al,2
  75.     out     61h,al
  76. InnerLoop:
  77.     cmp     dl,dh
  78.     jne     NoShutDown
  79.     and     al0FCh
  80.     out     61h,al
  81. NoShutDown:
  82.     inc     dh
  83.     cmp     dh,32
  84.     jne     InnerLoop
  85.     inc bp
  86.     loop    OuterLoop
  87.     sti
  88.     pop     ax
  89.     out     61h,al
  90.     pop     es
  91.     pop     bp
  92.     retf
  93. _VoiceTrk endp
  94.     end
  95.      
  96.  
  97.  
  98.  
  99.